#include <cstdio>
int map[100][100] = {0};

int main()
{
	freopen("task20.in", "r",  stdin);
	freopen("task20.ans", "w", stdout);
	int n = 0, m = 0, k = 0;
	scanf("%d %d %d", &n, &m, &k);
	int sex = 0, no = 0;
	for ( int i = 0; i < k; i++ ) {
		scanf("%d %d", &sex, &no);
		if ( sex == 0 )
		{
			for ( int col = 1; col <= m; col++ ) 
			{
				map[no][col] ++;
			}
		}
		else if ( sex == 1 )
		{
			for ( int line = 1; line <= n; line++ ) 
			{
				map[line][no] ++;
			}
		}
	}
	
	int x = 0, y = 0;
	for ( int i = 1; i <= n; i++ )
	{
		for ( int j = 1; j <= m; j++ )
		{
			if ( map[i][j] >= 2 ) {
				x ++;
			}
			else if ( map[i][j] == 0 ) {
				y ++;
			}
		}
	}
	printf("%d\n", x);
	printf("%d", y);
	return 0;
}
